StyleTransfer infers the number of filters #1414
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Extends #1380
Closes #281
This PR removes some of the hard-coded values in
StyleTransfer
so that it can work with user-trained models which were trained using a different number of filters. Specifically, the Van Gogh models here.We can derive the
numFilters
by looking at the shape of the filter variable. These shapes are specified in the manifest.json, but I'm just looking at the filter tensor directly.The input does not need to be any particular size, so I am removing the
IMAGE_SIZE
and theVideo
base class which uses it. The resizing didn't work anyways! We still have issues with video loading in Safari, though I'm getting a different error than before.I wonder if the
strides
is also something that's variable which we want to infer?